﻿using Newtonsoft.Json;
using System;

namespace CuteRibs.WowArmory.Models
{
	#region RealmStatus
	public class RealmStatus : BNObjectBase
	{
		[JsonProperty("realms")]
		public Realm[] Realms { get; set; }
	}
	#endregion

	#region Realm
	/// <summary>
	///	{
	///		"type": "pve",
	///		"population": "medium",
	///		"queue": false,
	///		"wintergrasp": {},
	///		"tol-barad": {},
	///		"status": true,
	///		"charName": "Medivh",
	///		"slug": "medivh",
	///		"battlegroup": "Ruin",
	///		"locale": "en_US",
	///		"timezone": "America/New_York"
	///	}
	/// </summary>
	public class Realm
	{
		[JsonProperty("type")]
		public string Type { get; set; }

		[JsonProperty("population")]
		public string Population { get; set; }

		[JsonProperty("queue")]
		public bool Queue { get; set; }

		[JsonProperty("wintergrasp")]
		public AreaStatus Wintergrasp { get; set; }

		[JsonProperty("tol-barad")]
		public AreaStatus TolBarad { get; set; }

		[JsonProperty("status")]
		public bool Status { get; set; }

		[JsonProperty("name")]
		public string Name { get; set; }

		[JsonProperty("slug")]
		public string Slug { get; set; }

		[JsonProperty("battlegroup")]
		public string Battlegroup { get; set; }

		[JsonProperty("locale")]
		public string Locale { get; set; }

		[JsonProperty("timezone")]
		public string Timezone { get; set; }

		#region AreaStatus
		/// <summary>
		/// {
		///		"area": 1,
		///		"controlling-faction": 0,
		///		"status": 2,
		///		"next": 1348335703150
		///	}
		/// </summary>
		[JsonObject]
		public class AreaStatus : BNObjectBase
		{
			[JsonProperty("area")]
			public int Area { get; set; }

			[JsonProperty("controlling-faction")]
			public int ControllingFaction { get; set; }

			/// <summary>
			///	-1: Unknown
			///	0: Idle
			///	1: Populating
			///	2: Active
			///	3: Concluded
			/// </summary>
			[JsonProperty("status")]
			public int Status { get; set; }

			[JsonProperty("next")]
			[JsonConverter(typeof(BNDateTimeConverter))]
			public DateTime Next { get; set; }
		}
		#endregion
	}
	#endregion
}
